Next | Prev | Up | Top | Contents | Index

Changing the Time Slice Duration

You can change the length of the time slice for all processes from its default 30ms using the systune command (see the systune(1) reference page). The kernel variable is slice_length; its value is the number of tick intervals that comprise a slice. There is probably no good reason to make a global change of the time-slice length.

You can change the length of the time slice for one particular process using the schectl() function (see the schedctl(2) reference page). The code would resemble Example 6-5.

Example 6-5 : Setting the Time-Slice Length

#include <sys/schedctl.h>
int setMyTimeSliceInTicks(const int ticks)
{
   int ret = schedctl(SLICE,0,ticks)
   if (-1 == ret)
      { perror("schedctl(SLICE)"); }
   return ret;
}
You might lengthen the time slice for the parent of a process group that will be gang-scheduled (see "Using Gang Scheduling"). This will keep members of the gang executing concurrently longer.


Next | Prev | Up | Top | Contents | Index